home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
cacheart.zip
/
CACHE.ART
next >
Wrap
Text File
|
1987-12-31
|
36KB
|
712 lines
LIVING WITH DOS: DISK CACHES
by Barry Simon
Copyright (c) 1987, Capital PC User Group Inc.
This material may be republished only for internal use
by other not-for-profit user groups.
Posted on Compuserve with permission of CPCUG. May not be
reproduced without including the above copyright notice.
Published in the March 1987 issue of the Capital PC Monitor;
discussion of extended memory has been changed from the published
article.
I/O, I/O, Its Off to Work We Go!
There is much noise made about running 286 based machines at 8, 10
or even 12 Megahertz. While running your computer's
microprocessor at a faster speed will make a difference, for many
tasks the difference is bounded because the limiting factor is
often the speed of your input and output devices known
collectively as I/O. That these devices slow down the CPU is seen
by the typical times involved. 8 MHz means that the CPU goes
through 8 million cycles per second. Since a single instruction
on the 80xx family of chips takes from two to over twenty cycles,
a CPU in the current generation of MS-DOS machine can run at
roughly 1 MIPS (millions of instructions per second).
Memory chips are rated at speeds of 70-200 nanoseconds. A
nanosecond is a billionth of a second which means that such chips
are capable of speed comparable to CPU speeds. That the speeds
are slightly less is shown by the need for "wait states", which
slow down the CPU to allow access to memory at its speed; RAM
speeds, however, are roughly equal to those of the CPU. I/O
speeds are considerably less. Even a fast hard disk rated at 20
milliseconds has a rated speed 100,000 times the speeds associated
to RAM. Of course, because the RAM speed is a statement about
each access and hard disk access times involve the first access of
a disk sector, the actual ratios are not that bad.
But memory access, even by slow memory chips, is much faster than
even speedy hard disks; diskettes are even slower. While disk
transfer rates are slower than RAM exchanges, they are speedy
compared to output through parallel or serial ports, where
transfer rates are measured in 100's of bytes per second. (1200
baud, for example, means roughly 120 characters per second.) And
your console, the name for the combined keyboard/monitor I/O
device must interface the computer's slowest component -- you;
its speeds are often the slowest of all.
There are software tools to try to speed up I/O especially by
using RAM for certain operations. This month, I'll discuss one
category of those tools -- disk caches; programs that can
substantially speed up disk access.
In this article, I discuss six commercial and one shareware disk
cache programs; the programs are:
o Emmcache, a shareware product by Frank Lozier;
o Lightning from the Personal Computer Support Group;
o Polyboost from Polytron;
o Quickcache from Microsystems Developers, Inc.;
o Speedcache from FSS Ltd;
o Super PC-Kwik from Multisoft Corp.; and
o Vcache from Golden Bow Systems.
What Is a Disk Cache?
Disk caches are based on the idea that you are likely to want to
access a file that you accessed recently. This is not only true
for obvious data files like a database which you might search
several times in a row, but also for program overlays and for the
files that DOS often consults to locate other files: the FAT and
the various directories, especially the root directory.
Thus every time that a file is accessed, a cache will keep a copy
of that file in memory set aside especially for that purpose.
Since this special memory is limited, the cache has to have an
algorithm to decide which parts of the cache to clear out to make
room for new sectors. All the caches under discussion use the
algorithm of discarding those parts of the cache which were least
recently accessed; that is, not the ones that were first read the
longest ago but rather than ones which were needed longest ago.
Whenever DOS calls for a sector from disk, the cache program
intercepts the call to check if the requested material is in the
cache memory. If it is, the copy in memory is used and a disk
access is saved. A cache can avoid anywhere from one-third to
two-thirds of your disk accesses. To allow a large cache, it is
natural to put the data part of the cache (that is, the copies of
the sectors which were read rather than code that controls this
data) in extended or expanded memory.
For safety's sake, you would not want these programs to delay
writing to disk material that DOS wants to write to disk; this is
called keeping dirty buffers and none of these programs keep dirty
buffers. However, as I'll explain, DOS does some of its own disk
caching and it does keep dirty buffers which can produce problems.
Do not confuse keeping dirty buffers, that is delaying writing to
disk, with caching writes. The latter means that the cache writes
to disk but keeps a copy of the material which is written to disk
if it is different from the copy that was read previously. For
example, if you load a file in your word processor, change it and
save it, a program that caches writes will save a copy of the
final file version in its cache while one that does not, will not
keep such a copy. All the commercial programs discussed in this
article cache writes, but Emmcache does not.
When I first started using a cache, I found the experience eerie.
I'd do some action that I often did and wondered why my disk
access light wasn't going on.
Types of Memory
In our discussion of caching, various references will be made to
the different kinds of memory that are available to microcomputer
users. These include:
o Conventional memory, the 640K of Random Access Memory (RAM)
that is readily accessible by most 8088/8086/80186 computers.
o Extended memory, the memory above 1 megabyte (up to 16
megabytes) that is accessible by 80286 computers. This memory
is not normally accessible for use as conventional memory but is
generally used for RAM disks, disk caches or print spoolers.
o Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS) and
supporting memory boards (up to 8 megabytes) are paged in and out
of conventional memory, thereby providing the user with additional
memory for supported software.
Not a Memory Cache
You should be careful to distinguish between a disk cache and
memory caches. There are circumstances where it may happen that
some of your RAM runs at a higher speed than most of your RAM. In
that case, it may pay to cache some of the reading of instructions
from the slow RAM to speed up programs with loops. Two situations
are where you add a speedup (usually 80186- or 80286-based) board
to a PC with lots of old RAM typically at 200 nanoseconds or with
386 machines where RAM that keeps up with the processor should be
rated at 100 or even 70 nanoseconds. In any event, these
situations involve a memory cache, not a disk cache which is the
subject of this article.
Caches Versus RAM Disks
You can also cut down on access to a physical disk by using a RAM
disk, that is by setting aside a part of RAM as a virtual disk
which DOS accesses as if it were an ordinary disk. There are
several differences between RAM disks and disk caches. Accessing
files from a RAM disk is often slightly faster as our time tests
will show. Moreover, the first access of a file with a cache will
be slower than later accesses. On the negative side, you must
decide in advance which files you'll want on the RAM disk; you'll
also have to be sure to copy any changed data files from the RAM
disk to a real disk or risk losing them when you power down or if
your system crashes.
Which should you use? That depends on how you use your computer.
If you only use a few programs without extensive data files, a RAM
disk is probably better if you can make one large enough to hold
what it needs to. In other circumstances, a cache may be
preferable. If you have the RAM, there may be sense in using
both: a RAM disk fo